package com.xcdh.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication()
public class XCDHGatewayApplication {
    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext app = SpringApplication.run(XCDHGatewayApplication.class, args);
        String ip = InetAddress.getLocalHost().getHostAddress(); // 获取本机IP
        String port = app.getEnvironment().getProperty("server.port");
        String appName = app.getEnvironment().getProperty("spring.application.name");
        System.out.println(String.format("服务%s 启动成功 http://%s:%s",appName,ip,port));
    }
}
